<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Initializes color functionality</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.ncurses-start-color" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ncurses_start_color</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.0.7, PHP 5 &lt; 5.3.0, PECL ncurses &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">ncurses_start_color</span> &mdash; <span class="dc-title">Initializes color functionality</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ncurses-start-color-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ncurses_start_color</strong></span>
    ( <span class="methodparam">void</span>
   ) : <span class="type">int</span></div>

  <p class="para rdfs-comment">
   Initializes color functionality in ncurses. This function must be called
   before any color manipulation functions are called and after
   <span class="function"><a href="ncurses_init.html" class="function">ncurses_init()</a></span> is called. It is good practice to call
   this function right after <span class="function"><a href="ncurses_init.html" class="function">ncurses_init()</a></span>.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.ncurses-start-color-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ncurses-start-color-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns <em>0</em> on success, or <em>-1</em> if the
   color table could not be allocated or ncurses was not initialized.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.ncurses-start-color-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-684">
    <p><strong>Example #1 Writing a string with a specified color to the screen</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />ncurses_init</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">//&nbsp;If&nbsp;the&nbsp;terminal&nbsp;supports&nbsp;colors,&nbsp;initialize&nbsp;and&nbsp;set&nbsp;active&nbsp;color<br /></span><span style="color: #007700">if&nbsp;(</span><span style="color: #0000BB">ncurses_has_colors</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ncurses_start_color</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ncurses_init_pair</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NCURSES_COLOR_YELLOW</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">NCURSES_COLOR_BLUE</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">ncurses_color_set</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />}<br /><br /></span><span style="color: #FF8000">//&nbsp;Write&nbsp;a&nbsp;string&nbsp;at&nbsp;specified&nbsp;location<br /></span><span style="color: #0000BB">ncurses_mvaddstr</span><span style="color: #007700">(</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">10</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"Hello&nbsp;world!&nbsp;Yellow&nbsp;on&nbsp;blue&nbsp;text!"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;Flush&nbsp;output&nbsp;to&nbsp;screen<br /></span><span style="color: #0000BB">ncurses_refresh</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">ncurses_end</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ncurses-start-color-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="ncurses_can_change_color.html" class="function" rel="rdfs-seeAlso">ncurses_can_change_color()</a> - Checks if terminal color definitions can be changed</span></li>
    <li class="member"><span class="function"><a href="ncurses_has_colors.html" class="function" rel="rdfs-seeAlso">ncurses_has_colors()</a> - Checks if terminal has color capabilities</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>